package com.clps.rulesregulations.dao;

import com.clps.rulesregulations.domain.*;
import com.clps.rulesregulations.util.ResourceTree;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * 制度目录管理数据接口
 *
 * @author zhangchao
 * @date 2018-10-11
 */
@Repository
@Mapper
public interface RegulationDao {

    /**
     * 查找所有树
     *
     * @return
     */
    LinkedList<ResourceTree> findAllAsTree();

    LinkedList<ResourceTree> findAllAsTreeByParentId(String id);

    LinkedList<ResourceTree> findMenuTree();

    LinkedList<ResourceTree> findDeptTrees();

    int selectMaxBatchNo();
    /**
     * 得到所有ID
     *
     * @return
     */
    List<Integer> findAllRegulationIds();

    List<Department> selectDepartmentKey();

    LinkedList<ResourceTree> findDirAsTree();
    LinkedList<ResourceTree> findAllDirAsTree();

    List<Integer> findDirRegulationIds();
    List<Integer> findAllDirRegulationIds();

    /**
     * 得到所有ID
     *
     * @return
     */
    void addRegulations(Regulation Regulation);

    void updateRegulationsList(List list);

    void deleteRegulationsList(List list);

    void deleteRuleList(List list);

    Integer getMaxSorder(Integer parentId);

    void saveRule(Rule rule);

    Rule selectRule(String id);

    void deleteRegulationMenuByid(Integer id);

    void deleteRule(Long id);

    Rule selectRuleByMenuId(String id);

    Rule selectRuleHis(String id);

    void updateRule(Rule rule);
    void updateRuleTitle(Rule rule);

    void updateRegulationMenu(Rule rule);

    HotSearch getFileHotSearchCount(String id);

    void insertFileHotSearchCount(String id);

    void updateFileHotSearchCount(String id);

    void saveRuleHis(Rule rule);

    List<Rule> findAllRules(Map<String, Object> condition);
    List<Schedule> findAllSchedules(Map<String, Object> condition);

    List<Rule> findAllRulesHis(Map<String, Object> condition);

    List<Rule> listLatestUpdFile(Map<String, Object> condition);

    List<Rule> showmoreeditfile(Map<String, Object> condition);

    List<Rule> showmorehotsearch(Map<String, Object> condition);

    List<Rule> listkeywordHot(Map<String, Object> condition);

    Regulation selectNewParentInfo(Integer parentId);

    Regulation selectRegByParentId(Integer parentId);

    List<Regulation> selectAllRegulations();

    List selectFileExistCount(List list);
    List getDelDirList(Integer id);

    List selectFileDirExistCount(String id);

    void revertVersion(Rule rule);

    void deleteRuleHis(String id);

    void insertAccessTalbe(AccessFile af);

    void scheduleEdit(@Param("id")String id,@Param("schedule")String schedule);

    List<Department> findKeyword();

    LinkedList<ResourceTree> selectByKeyword(@Param("keyword")String keyword, @Param("id")Integer id);
    LinkedList<ResourceTree> findAllDept();

    List<Regulation> selectAllSonFiles(@Param("catalogId")String catalogId,@Param("id")String id);
    List<Regulation> selectAllSonDirs(@Param("catalogId")String catalogId,@Param("id")String id);

    Rule selectCoverRule(@Param("title")String title, @Param("catalogId")Integer catalogId);

    void saveFile(RuleFilelist rf);
    void updateFile(RuleFilelist rf);
    void delFile(RuleFilelist rf);

    List<RuleFilelist> getFileList(String ruleId);

    void updateAttendInfo(Rule rule);

    List<Schedule> selectSchedule(Long ruleId);
    void updateUserSchedule(Schedule schedule);
    void insertUserSchedule(Schedule schedule);
    void deleteSchedule(Long ruleId);

    Rule selectRuleByCatalogId(Integer id);
}
